package cn.wolfcode.shop.cloud.web.controller;

import cn.wolfcode.shop.cloud.common.Result;
import cn.wolfcode.shop.cloud.service.RedisService;
import cn.wolfcode.shop.cloud.util.SeckillKeyPrefix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class GetPathController {
    @Autowired
    private RedisService redisService;
    @RequestMapping("getPath")
    public Result getPath(String uuid){
        String path = UUID.randomUUID().toString().replaceAll("-", "");
        //把path存到redis里
        redisService.set(SeckillKeyPrefix.REDIS_SECKILL_PATH,uuid,path);
        return Result.success(path);
    }
}
